import { S } from '../s';
import { IPSAppCodeList } from '../app/codelist/ipsapp-code-list';
import { IPSDataItem } from './ipsdata-item';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSDataItemImpl extends PSModelObjectImpl implements IPSDataItem {
  get dataType():
    | 0
    | 1
    | 2
    | 3
    | 4
    | 5
    | 6
    | 7
    | 8
    | 9
    | 10
    | 11
    | 12
    | 13
    | 14
    | 15
    | 16
    | 17
    | 18
    | 19
    | 20
    | 21
    | 22
    | 23
    | 24
    | 25
    | 26
    | 27
    | 28
    | 29 {
    return this.M.dataType;
  }

  get format(): string {
    return this.M.format;
  }

  get name(): string {
    return this.M.name;
  }

  protected pscodelist: IPSAppCodeList;
  getPSCodeList(): IPSAppCodeList | null {
    return (
      this.pscodelist ||
      (this.pscodelist = this.fillObjectModel(
        S._8,
        this.M.getPSCodeList,
        S._2e5,
      ) as IPSAppCodeList)
    );
  }

  get convertToCodeItemText(): boolean {
    return this.M.convertToCodeItemText != null
      ? this.M.convertToCodeItemText
      : false;
  }
  get cls(): string {
    return 'PSDataItemImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._28b) return true;
    return super.instanceof(cls);
  }
}
